﻿using System.Data.Entity;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using log4net.Config;
using Pyramid.Models;
using Pyramid.Models.Migrations;

[assembly: XmlConfigurator(ConfigFile = "Web.config", Watch = true)]

namespace Pyramid
{
	public class MvcApplication : HttpApplication
	{
		protected void Application_Start()
		{
			AreaRegistration.RegisterAllAreas();

			WebApiConfig.Register(GlobalConfiguration.Configuration);
			FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
			RouteConfig.RegisterRoutes(RouteTable.Routes);
			BundleConfig.RegisterBundles(BundleTable.Bundles);

			ModelValidatorProviders.Providers.Clear();

			Database.SetInitializer(new MigrateDatabaseToLatestVersion<PyramidDbContext, Configuration>());
		}
	}
}